#include "apilib.h"
#include "stdlib.h"

void HariMain(void)
{
	int LBA;
	char c, cmdline[30], *p;
	char buffer[512];
	int i;

	api_cmdline(cmdline, 30);
	for (p = cmdline; *p > ' '; p++) { }	/*跳过之前的内容，直到遇到空格*/
	for (; *p == ' '; p++) { }	/*跳过空格*/
	LBA = atoi(p);
	if(api_read_hard_disk_0(LBA, buffer)!= 0)
	{
		api_putstr0("read disk err\r\n");
		api_end();
	}
	for(i=0; i<512; i++)
	{
		if(buffer[i] == 0)
		{
			break;
		}
		api_putchar(buffer[i]);
	}
	api_putstr0("\r\n");
	sprintf(buffer, "read %d byte\r\n", i);
	api_putstr0(buffer);
	api_end();
}
